#!/usr/bin/python3

import smtplib
import time
from email.header import Header
from email.mime.text import MIMEText

# 第三方 SMTP 服务
mail_host = "smtp.exmail.qq.com"  # 设置服务器
mail_user = "liut@liut.xyz"  # 用户名
mail_pass = "7zYTUgBebA3JbpvZ"  # 口令

sender = 'liut@liut.xyz'
receivers = ['jinglekang@live.cn']  # 接收邮件，可设置为你的QQ邮箱或者其他邮箱

message = MIMEText('测试', 'plain', 'utf-8')
message['From'] = Header("liut", 'utf-8')
message['To'] = Header("沙雕", 'utf-8')

subject = 'liut-test'
message['Subject'] = Header(subject, 'utf-8')

smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host, 25)  # 25 为 SMTP 端口号
smtpObj.login(mail_user, mail_pass)

num = 100
while num > 0:
    # smtpObj.sendmail(sender, receivers, message.as_string())
    print("邮件发送成功 - " + str(num))
    num = num - 1
    time.sleep(30)

print("已完成")
